package com.olclass.web.util;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * FileName: SessionUtil.java
 * Author:   Administrator
 * Date:     2021/4/18 15:47
 * Description:
 */
public class SessionUtil {

    public static String getUserId(HttpServletRequest request){
        HttpSession session = request.getSession();
        String userid = session.getAttribute("userid").toString();
        if(StringUtils.isNotBlank(userid)){
            return userid;
        }else {
            throw new RuntimeException(CommonConstants.RESPONSE_STATUS_LOGINOUT);
        }
    }

}